XWidgetSoft Forum
https://www.bbs.xwidget.com/

HELP: How to make a second hand move more smoothly : CLOSED
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=6052
Page 1 of 1

Author:  yereverluvinuncleber [ December 4th, 2015, 8:47 am ]
Post subject:  HELP: How to make a second hand move more smoothly : CLOSED

I have a rotator for a second hand and have bound it to the datetimecore using the ${SecondPercent} tag to control clock hand movement. The hand moves one tick each second.

I would like to make the hand move more smoothly and to slide around the face moving in tenths of a second divisions. Is there a tag that does this automatically or do I have to do it in code?

Author:  yereverluvinuncleber [ December 8th, 2015, 4:20 am ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly - CLO

BUMP: anyone out there with an idea as to how to do this with the IDE, timer cores and tags?

I can simply do it in code using javascript with the following function called by a timer with an interval of 0.1s

function updateTime() {
var theDate = new Date();

var theSeconds = theDate.getSeconds();
var theMilliseconds = theDate.getMilliseconds();
var useSeconds = Math.round(10 * (theSeconds + (theMilliseconds / 1000))) / 10;
secondHand.RotateAngle = (useSeconds * 6) % 360;
}

The above code is standard .js and might need fettling for Xwidget to extract the date/time information - Xwidget provides this sort of data.

Click on the second hand and unbind the datetimecore2 and remove the tag.
Clicking on datetimecore2 allows you to select the functions for it - you should add 'updateTime'.
This got the hands rotating at a 1 second interval.

Set the interval on datetime core to 100ms, smooth animation now achieved.

Do the same for any shadow image you have created and the shadow will rotate in synch. with the second hand.

Note: the hands only rotate when the widget is running and not in the IDE.

Author:  Jimking [ December 8th, 2015, 6:08 am ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

I don't understand very well your thought man, but check the "Animate" tab -> Switch Aanimation and test the various combinations/effects changing also the "Duration (Sec)". Keep in mind to control the cpu usage though...

Author:  yereverluvinuncleber [ December 8th, 2015, 3:03 pm ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

I'll have a look, thanks - but the usage of the switch animation is completely unclear to me and in the absence of any documentation I don't currently see how to use this part of the Xwidget IDE. If you have used it and have some examples then I'd appreciate the help.

Instead I have added that javascript function which is called by the datetime core on the onUpdate event. Instead of using the Xwidget functions it uses the rotateAngle property to rotate the second hand. It seems to work very well.

What I was looking for Jim is a way of using the ${SecondPercent} tag or similar to move the second hand smoothly rather than jerkily, the ${SecondPercent} tag rotates the hand only once per second.

That Konfabulator widget, the thread of which you deleted earlier, shows exactly how I want the hand to move.

Author:  Jimking [ December 8th, 2015, 4:53 pm ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

Quote:
I'll have a look, thanks - but the usage of the switch animation is completely unclear to me and in the absence of any documentation I don't currently see how to use this part of the Xwidget IDE. If you have used it and have some examples then I'd appreciate the help.

To check the cpu usage of your widget, simple after click on "debug", open the task manager (alt-ctrl-delete) and check the cpu for the xwtest.exe

Unfortunately my knowledge is limited on jscript. The only thing that I can tell you, is that you need to "play" with the "switch animation" tab, the selections and make various combinations. You can have some cool effect there..!

Example of smooth movement:
http://jimking.deviantart.com/art/Flash ... -534805371

pm: If you want you can post here your work-in-progress widget and let me test it..

Author:  yereverluvinuncleber [ December 8th, 2015, 6:15 pm ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

Thankyou Jim, I'll post the widget here shortly for you to have a look at. That widget you directed me to should be enough as it does some nifty stuff - I'll have a look and see how it does what it does, thanks!

Author:  yereverluvinuncleber [ December 8th, 2015, 6:33 pm ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

That is a very nifty effect and I do like it. I see what you are trying to recommend, to add a linear effect to the rotation of the hand, I can't get it to work but I like the idea.

Author:  yereverluvinuncleber [ December 12th, 2015, 8:09 am ]
Post subject:  Re: HELP: tag to make a second hand move more smoothly

See my second post on how I fixed it. Doing it in javascript code is much more simple than trying to figure out how to use an undocumented feature in Xwidgets.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/