From: David Marcovitz on
On 4/21/10 6:19 PM, lizsantiago wrote:
> you wont beleive it but i am still looking to achieve this game, i saw the link which directed me to a spinnner but that is for sell, is that made with animations only? cuse i have try all animations in the panel and cant till find one that stop the wheel in different points randomly, i can only stop it at points set with the rotation degree and that is not random cuse it will only stop at those points and after playing a few time my students will know what comes next, unless i redo all the animations again.
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.powerpoint/Please-Heeeeelp-Vba-code-to-add-animation-to-an-existing-object


What if we take a different approach. I am imagining two possibilities:

(1) Have one shape and use VBA to adjust the rotation.
(2) Have multiple shapes drawn at different rotations and use VBA to
cycle through which shape is showing at which time.

Either way, you can use generate a random number to decide how many
times to rotate the shape and or cycle through the pictures. It might
not be quite as smooth as an animation, but it shouldn't be too hard and
should do the trick.

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
From: David Marcovitz on
On 4/22/10 12:55 PM, David Marcovitz wrote:
> On 4/21/10 6:19 PM, lizsantiago wrote:
>> you wont beleive it but i am still looking to achieve this game, i saw
>> the link which directed me to a spinnner but that is for sell, is that
>> made with animations only? cuse i have try all animations in the panel
>> and cant till find one that stop the wheel in different points
>> randomly, i can only stop it at points set with the rotation degree
>> and that is not random cuse it will only stop at those points and
>> after playing a few time my students will know what comes next, unless
>> i redo all the animations again.
>>
>> ---
>> frmsrcurl:
>> http://msgroups.net/microsoft.public.powerpoint/Please-Heeeeelp-Vba-code-to-add-animation-to-an-existing-object
>>
>
>
> What if we take a different approach. I am imagining two possibilities:
>
> (1) Have one shape and use VBA to adjust the rotation.
> (2) Have multiple shapes drawn at different rotations and use VBA to
> cycle through which shape is showing at which time.
>
> Either way, you can use generate a random number to decide how many
> times to rotate the shape and or cycle through the pictures. It might
> not be quite as smooth as an animation, but it shouldn't be too hard and
> should do the trick.
>
> --David
>

I played with this a little bit. I can't get it to go fast, but this
code does the spinning. After this, you just need to check the rotation
of the object to calculate what number it landed on:

Sub Spin()
Dim spinNumber As Long
Dim i As Long

Randomize
spinNumber = 360 * Rnd
For i = 1 To spinNumber
ActivePresentation.Slides(1).Shapes(2).IncrementRotation (1)
'Sleep 1
ActivePresentation.SlideShowWindow.View.GotoSlide 1
Next i

End Sub


--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
From: lizsantiago on
I will try it tomorrow and post how it went, i want to thank you and all the people here who have been trying to help me.

---
frmsrcurl: http://msgroups.net/microsoft.public.powerpoint/Please-Heeeeelp-Vba-code-to-add-animation-to-an-existing-object
From: Steve Rindsberg on
Your PPT 2007 visibility bug or its cousin?

I started with your code and modified it a wee bit ... for all intents
and purps it's identical, just a bit more generic. This lets me assign
the macro as an action setting on the shape so it acts when clicked on.
Works nicely in 2003 ... haven't tried it in
bugfest^H^H^H^H^H^H^H2007.

Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub Spin(oSh As Shape)
Dim spinNumber As Long
Dim i As Long

Randomize
spinNumber = 360 * Rnd
For i = 1 To spinNumber
oSh.IncrementRotation (1)
Sleep 1
ActivePresentation.SlideShowWindow.View.GotoSlide
oSh.Parent.SlideIndex
Next i

End Sub



==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


From: David Marcovitz on
I can't remember if I was trying this in 2003 or 2007 (I think 2003),
but I was having problems with the speed. It seemed that no matter what
I did, every rotation would take about a second. I tried Sleep , and
that just slowed it down more, which is why I dropped it from my code.
And when I left out the GotoSlide, it wouldn't refresh at all and just
pause and then randomly show up with something rotated. Initially, I
imagined this spinning around several times in a few seconds, but I cut
it down to a maximum rotation of 1 time around so it wouldn't take forever.
--David

On 4/23/10 1:48 PM, Steve Rindsberg wrote:
> Your PPT 2007 visibility bug or its cousin?
>
> I started with your code and modified it a wee bit ... for all intents
> and purps it's identical, just a bit more generic. This lets me assign
> the macro as an action setting on the shape so it acts when clicked on.
> Works nicely in 2003 ... haven't tried it in
> bugfest^H^H^H^H^H^H^H2007.
>
> Option Explicit
>
> Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
>
> Sub Spin(oSh As Shape)
> Dim spinNumber As Long
> Dim i As Long
>
> Randomize
> spinNumber = 360 * Rnd
> For i = 1 To spinNumber
> oSh.IncrementRotation (1)
> Sleep 1
> ActivePresentation.SlideShowWindow.View.GotoSlide
> oSh.Parent.SlideIndex
> Next i
>
> End Sub
>
>
>
> ==============================
> PPT Frequently Asked Questions
> http://www.pptfaq.com/
>
> PPTools add-ins for PowerPoint
> http://www.pptools.com/
>
>


--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland