Page 1 of 1
Graphic Rotating 5 Point Star - Solved
Posted: Wed Aug 28, 2013 11:00 am
by DR White
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
Re: Graphic Rotating 5 Point Star
Posted: Wed Aug 28, 2013 12:49 pm
by dave_probertGA6e24
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
Re: Graphic Rotating 5 Point Star
Posted: Wed Aug 28, 2013 1:38 pm
by bn
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
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
it will increase the textSize from 10 (minimum) to 42 (max) depending on the size of the star
Kind regards
Bernd
Re: Graphic Rotating 5 Point Star
Posted: Wed Aug 28, 2013 2:26 pm
by dave_probertGA6e24
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:
Code: Select all
set the forecolor of it to 0,0,0
set the showName of it to true
Cheers,
Dave
Re: Graphic Rotating 5 Point Star
Posted: Wed Aug 28, 2013 10:18 pm
by DR White
Dave P,
WOW!! Your ZoomStar stack is AWESOME!!!
I Love it when someone attaches the code.
Thanks VERY MUCH,
David W
Re: Graphic Rotating 5 Point Star
Posted: Wed Aug 28, 2013 10:20 pm
by DR White
Bernd,
Thank you for putting the icing on the cake with the expanding text.
David W