XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Aug 18日 08:21

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 2015年 Dec 4日 08:47 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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?


Last edited by yereverluvinuncleber on 2015年 Dec 16日 08:38, edited 2 times in total.

Top
 Profile  
 
PostPosted: 2015年 Dec 8日 04:20 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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.


Last edited by yereverluvinuncleber on 2015年 Dec 12日 08:06, edited 1 time in total.

Top
 Profile  
 
PostPosted: 2015年 Dec 8日 06:08 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4526
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...

_________________
Image
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
PostPosted: 2015年 Dec 8日 15:03 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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.


Top
 Profile  
 
PostPosted: 2015年 Dec 8日 16:53 
Offline
User avatar

Joined: 2012年 Dec 5日 17:52
Posts: 4526
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..

_________________
Image
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
PostPosted: 2015年 Dec 8日 18:15 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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!


Top
 Profile  
 
PostPosted: 2015年 Dec 8日 18:33 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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.


Top
 Profile  
 
PostPosted: 2015年 Dec 12日 08:09 
Online
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 536
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group