Graphic Rotating 5 Point Star - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Graphic Rotating 5 Point Star - Solved
I am working on a simple Children's game in which I want to have a star starting small in the back of the screen and
becoming larger and rotating, to give the appearance of coming toward the student.
I have been successful in rotating a polygon with "revRotatePoly", but I cannot make a star from the polygon and therefore cannot rotate a star
(using an image does not have the quality effect that I am looking for).
Also, If possible I need to put different words in the star as it moves towards the student.
Is this possible in LiveCode?
Thanks,
David
becoming larger and rotating, to give the appearance of coming toward the student.
I have been successful in rotating a polygon with "revRotatePoly", but I cannot make a star from the polygon and therefore cannot rotate a star
(using an image does not have the quality effect that I am looking for).
Also, If possible I need to put different words in the star as it moves towards the student.
Is this possible in LiveCode?
Thanks,
David
Last edited by DR White on Thu Sep 19, 2013 2:56 am, edited 2 times in total.
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: Graphic Rotating 5 Point Star
Hi David,
The built in graphics tools at the moment don't have an easy way of making a star shape. But they are basically polygons with specific points set in their 'points' field - so the 'easy' way to do this is via some simple Maths.
I have attached an example of a star drawing function and animation thingy. Take a look - most all of it is commented and the code is all on the card script area (except for a single line in the button).
To do the text on top you would simply add a text field and reposition/scale it at the same time as drawing the star (in the 'tickTock' function I would suggest). If you need help with that then just let me know and I can make an example for you.
Hope this helps.
Cheers,
Dave
The built in graphics tools at the moment don't have an easy way of making a star shape. But they are basically polygons with specific points set in their 'points' field - so the 'easy' way to do this is via some simple Maths.
I have attached an example of a star drawing function and animation thingy. Take a look - most all of it is commented and the code is all on the card script area (except for a single line in the button).
To do the text on top you would simply add a text field and reposition/scale it at the same time as drawing the star (in the 'tickTock' function I would suggest). If you need help with that then just let me know and I can make an example for you.
Hope this helps.
Cheers,
Dave
- Attachments
-
- ZoomStar.livecode.zip
- (1.85 KiB) Downloaded 392 times
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
Re: Graphic Rotating 5 Point Star
Hi Dave,
what a beautiful example stack.
If David wants to display text I propose he sets the label of graphic theStar to his text by script (you can not set the label of a graphic in properties inspector) and set the showName of the graphic to true. Then add this to the script in the ticToc handler
it will increase the textSize from 10 (minimum) to 42 (max) depending on the size of the star
Kind regards
Bernd
what a beautiful example stack.
If David wants to display text I propose he sets the label of graphic theStar to his text by script (you can not set the label of a graphic in properties inspector) and set the showName of the graphic to true. Then add this to the script in the ticToc handler
Code: Select all
// ---- increase the star size
put round(osize * 1.05) into osize
put osize div 10 into tTextSize -- added bn
set the textSize of grc "theStar" to min(max(tTextSize,10),42) -- added bn
// ---- change the star angle
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: Graphic Rotating 5 Point Star
Thankyou Bernd,
That's a nice simple addition to it for the text. I didn't know that the textsize of a label could be changed for a graphic - cool.
The only thing it would need too is this in the 'create' part in init:
Cheers,
Dave
That's a nice simple addition to it for the text. I didn't know that the textsize of a label could be changed for a graphic - cool.
The only thing it would need too is this in the 'create' part in init:
Code: Select all
set the forecolor of it to 0,0,0
set the showName of it to true
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
Re: Graphic Rotating 5 Point Star
Dave P,
WOW!! Your ZoomStar stack is AWESOME!!!
I Love it when someone attaches the code.
Thanks VERY MUCH,
David W
WOW!! Your ZoomStar stack is AWESOME!!!

I Love it when someone attaches the code.
Thanks VERY MUCH,
David W
Last edited by DR White on Wed Aug 28, 2013 10:22 pm, edited 2 times in total.
Re: Graphic Rotating 5 Point Star
Bernd,
Thank you for putting the icing on the cake with the expanding text.
David W
Thank you for putting the icing on the cake with the expanding text.
David W