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

Swim Widget on a certain direction?
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=4708
Page 1 of 1

Author:  Jimking [ July 10th, 2014, 1:48 am ]
Post subject:  Swim Widget on a certain direction?

I have 9 pngs water drop images, and I would like to make a "swim" full screen widget.
QUESTIONS:
1) Is possible using the "swim" widget's optionto make the drops going only from up to down and in a steady vertical position like in real life..?
2) Can we combine all the 9 images so they will appear randomly..?

Thank you!

Attachments:
drops.zip [34.62 KiB]
Downloaded 346 times

Author:  digigamer [ July 10th, 2014, 2:22 am ]
Post subject:  Re: Swim Widget on a certain direction?

I think it will be better to attach them into a slider and make a full screen widget.
I went through the docs, but couldn't find anything about swim direction

Author:  Jimking [ July 10th, 2014, 4:42 am ]
Post subject:  Re: Swim Widget on a certain direction?

Hi DG! Thanks for the quick reply..
The fact is that with the widget->"swim" option as you know the images floating randomly. I'm almost sure that should be a way to control the movement though script, but as it seems from my topic here I don't know how.. :)

Author:  hamid [ July 10th, 2014, 11:02 am ]
Post subject:  Re: Swim Widget on a certain direction?

jimking wrote:
The fact is that with the widget->"swim" option as you know the images floating randomly.
with [widget>swim], whole widget will floating on screen, not only images;
this means all images get floated together



Quote:
I'm almost sure that should be a way to control the movement though script, but as it seems from my topic here I don't know how.. :)
for [widget>swim], the only option that i found is to control [OnSwimToLeft] event and [OnSwimToRight] event
there is a way to make it possible to swim only one direction for left/right, not up/down


can you explain more how you want the images to be shown?

Author:  Jimking [ July 10th, 2014, 12:08 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Hi hamid!
If you check my attach file you will see that are 9 different water drop images like this one:
Image

So I was thinking to make a full screen images where the drops will fall from top to bottom like a rain effect on screen!
Imagine like a "swim" widget (without use the "keep on screen" swim option), but the images will move only in a vertical random position.
The best of course is to have also random the start point of the drop. Other will start fall from the top, other from the middle..
Just think a rain effect on the screen.. :)

Author:  hamid [ July 10th, 2014, 12:42 pm ]
Post subject:  Re: Swim Widget on a certain direction?

couldn't imagine this with swim effect
maybe you want it to create wind

but why don't you create a png animation or a gif?

Author:  Jimking [ July 10th, 2014, 1:27 pm ]
Post subject:  Re: Swim Widget on a certain direction?

I told you practically I can create 9 animated pngs with the fall animation..
But we can make their appearance ramdom on screen..?
(I was thinking the swim option to give you an idea about how it will look..)
Quote:
couldn't imagine this with swim effect
maybe you want it to create wind

This is the question..If is possible to control their movement though script..

Author:  hamid [ July 10th, 2014, 1:38 pm ]
Post subject:  Re: Swim Widget on a certain direction?

for the fall animation, we can also use progressbar:
Attachment:
raindrop_[test1] [2014.05.07].xwp [41.81 KiB]
Downloaded 372 times

but i think creating animation file is better
maybe it uses less resources

jimking wrote:
I told you practically I can create 9 animated pngs with the fall animation..
But we can make their appearance ramdom on screen..?

if you create animation file for each of the images, then it can be done
randomizing will be done like the broken screen widget


edit1:
Note:
in above attachment i have rotated the images to be used on up-to-down progressbar


============
edit2:
i don't know why i used progressbar for this
we can use image object for this without rotating image:
Attachment:
raindrop_[test2] [2014.05.07].xwp [41.13 KiB]
Downloaded 380 times

but still i think creating animation file will be better

Author:  Jimking [ July 10th, 2014, 2:38 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Both test files are great!! :)
How about the control of the fall speed...?
Quote:
if you create animation file for each of the images, then it can be done
randomizing will be done like the broken screen widget

It's not so hard but surely requires some time..
I'm really curious to see which of the two modes use less resources..
Since it will cover all the screen's height (x768) and the number of the pngs will be high, maybe the anim png is worst..
But I need to test it first..

Author:  hamid [ July 10th, 2014, 4:20 pm ]
Post subject:  Re: Swim Widget on a certain direction?

here's with more images,
but doesn't added random image
Attachment:
raindrop_[test3] [2014.07.11].xwp [41.47 KiB]
Downloaded 352 times


i think cpu usage is high for it
plz test it


===========
Quote:
How about the control of the fall speed...?

fall speed can be set using:
1. image position increment, ex: image1.Top+=12
2. setTimeout execution time, ex: setTimeout("Rainfall",20)

Author:  Jimking [ July 10th, 2014, 4:59 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Testing your last file "raindrop_[test3] [2014.07.11].xwp" the cpu usage is 0~2%!! :D
I will make some more tests decreasing the speed and adding the various pngs and I'll reply as soon as possible...

Author:  Jimking [ July 11th, 2014, 2:12 am ]
Post subject:  Re: Swim Widget on a certain direction?

I made some little changes to the script and edited the scale % of some images to be more realistic..
Cpu usage=0%

Next steps:
- Randomize their movement on x-axis? <- ->
- (more complicated) With mouse click appear of a random water drop (like the "Broken Screen")

I try to study the script from the "Broken Screen" widget and copy the function but is a bit confusing for me...

Attachments:
raindrop_[test4].xwp [41.49 KiB]
Downloaded 353 times

Author:  hamid [ July 11th, 2014, 5:10 am ]
Post subject:  Re: Swim Widget on a certain direction?

Quote:
Cpu usage=0%
Cpu Usage will be different on different PCs
mine is also 0
but you can see usage better on a graph
it's not high, but i think it shouldn't be this for a widget (that will be always running)
can you create a gif or png animation to test it with that?

and why don't you use animation effect (like your rocket_recycle_bin widget)?
i'm not so familiar with animation effects of xwidget, so i can't use it myself


jimking wrote:
- Randomize their movement on x-axis? <- ->
why should it move on x-axis?
their speed make me imagine it as water-drops, not raindrops
are they going to be water-drops?
then why they should move on x-axis?
do you mean zigzag?
can you show the movement in an image?


Quote:
- (more complicated) With mouse click appear of a random water drop (like the "Broken Screen")
1. should it start from click position?
2. do you mean random image files? they are not so different in shape

Author:  Jimking [ July 11th, 2014, 6:51 am ]
Post subject:  Re: Swim Widget on a certain direction?

Quote:
why should it move on x-axis?
their speed make me imagine it as water-drops, not raindrops
are they going to be water-drops?
then why they should move on x-axis?
do you mean zigzag?
can you show the movement in an image?

I was thinking more like raindrops.. (But even as a water-drops the water falls randomly..)
I mean that their vertical position will change. They will drop from a random left/right position.
For now, each drop keeps the same x-asis position. (up&down movement in a steady x-asis)

Quote:
1. should it start from click position?
2. do you mean random image files? they are not so different in shape

1. Yes (double click is better)
2. I know.. Not all but maybe 2-3 different images..

Quote:
can you create a gif or png animation to test it with that?
and why don't you use animation effect (like your rocket_recycle_bin widget)?

I can do it but it needs time.. I have to create a transparent image with GIMP with 768 height resolution as my laptop.
Image that I have to start from top, and using the keyboard move it lower and lower, and save each image.. I think that we will need +200png images for each kind of drop!!! :!:
Since is working fine with your own way, the cpu is ~0%, why do all this work...

Author:  hamid [ July 11th, 2014, 7:03 am ]
Post subject:  Re: Swim Widget on a certain direction?

i just found how to use animation effects of xwidget for images
but really doesn't useful
it uses very high Cpu usage (about 50% of mine)


so using the code is better for now
i have added the code for disable widget when it's hide
this way we could make lower cpu usage when it's hidden


Quote:
I was thinking more like raindrops.. (But even as a water-drops the water falls randomly..)
I mean that their vertical position will change. They will drop from a random left/right position.
For now, each drop keeps the same x-asis position. (up&down movement in a steady x-asis)

1. Yes (double click is better)
2. I know.. Maybe 2-3 different images..

ok, now i'm working on it

Author:  Jimking [ July 11th, 2014, 7:43 am ]
Post subject:  Re: Swim Widget on a certain direction?

Ok thanks! I'm waiting for the "test5"... :)

Quote:
i just found how to use animation effects of xwidget for images
but really doesn't useful
it uses very high Cpu usage (about 50% of mine)

Yes I know.. These switch/animations option are almost useless. You need a certain design, size and function to use them with low cpu.
One thing that I wish for the v2.0 of XW is low consumption for the effects..

Author:  hamid [ July 11th, 2014, 1:57 pm ]
Post subject:  Re: Swim Widget on a certain direction?

ok, it's ready:
Attachment:
raindrop_[test5] [2014.07.12].xwp [37.72 KiB]
Downloaded 358 times


=========
Changes:
Added: Disabling/Enabling on Hide/Show to save Cpu Usage when it's Hidden
Added: MenuItem to Clear Screen
Added: MenuItem to Set Number of images
Added: Code to automatically create imageObjects
Added: Code for Random ImageFile Usage
Added: Code for Random Speed, Position for each Object
Added: Widget LockPosition and MouseThrough
Removed: Extra ImageObjects from widget
===========

Note:
-Adding more than 10 ImageObjects will cause cpu usage go high
(for me getting 20-30%)

Author:  Jimking [ July 11th, 2014, 3:00 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Visualy is reallly GREAT! And your script is rock!
But I can't activate the right click option or click on the widget(move).. :?
Maybe of this "Added: Widget LockPosition and MouseThrough"...?

Author:  hamid [ July 11th, 2014, 3:31 pm ]
Post subject:  Re: Swim Widget on a certain direction?

jimking wrote:
Visualy is reallly GREAT! And your script is rock!
But I can't activate the right click option or click on the widget(move).. :?
Maybe of this "Added: Widget LockPosition and MouseThrough"...?

yes, it' MouseThrough
you can activate widget by pressing Ctrl button
same way as BrokenScreen widget


Note:
also if you add about 100 imgObjects, RightClick Menu of widget and even Click on widget may not work
this is because of high cpu usage

Author:  Jimking [ July 11th, 2014, 3:35 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Quote:
yes, it' MouseThrough
you can activate widget by pressing Ctrl button
same way as BrokenScreen widget

Yes you're right.. I forgot it!
Quote:
also if you add about 100 imgObjects RightClick Menu and even Click of mouse may not work
this is because of high cpu usage

Yes it's logical. I will keep it in mind..

Excellent work as always bro! ;)

Author:  hamid [ July 11th, 2014, 6:17 pm ]
Post subject:  Re: Swim Widget on a certain direction?

Here's the new version:
Attachment:
raindrop_[test6] [2014.07.12].xwp [37.92 KiB]
Downloaded 337 times


==========
Changes:
Added: Cleaner Code and Menuitem to clean the drops on mouseenter
Added: the Mouse Cursor for Cleaner

fixed: Saveini() have been missed in previous code,
-> i don't know how it works without it, maybe it doesn't require anymore,
-> but i added it for compatibility with old versions
============

Author:  Jimking [ July 12th, 2014, 12:58 am ]
Post subject:  Re: Swim Widget on a certain direction?

Quote:
Changes:
Added: Cleaner Code and Menuitem to clean the drops on mouseenter
Added: the Mouse Cursor for Cleaner

Great addition! 8-)
I think is ready now. We're or better YOU did it..!

Author:  hamid [ July 12th, 2014, 7:20 am ]
Post subject:  Re: Swim Widget on a certain direction?

i have added some additional things
i think this is the final work on this

here's new version:
Attachment:
raindrop_[test7] [2014.07.12].xwp [38.13 KiB]
Downloaded 362 times


==========
Changes:
Added: Enable Counter Menuitem and code to count the number of items
Added: Some Optimization to Code to make it easier to read
Added: Producer Info to the script code's Comment
============

Author:  Jimking [ July 12th, 2014, 8:40 am ]
Post subject:  Re: Swim Widget on a certain direction?

Nice!! I will edit the "Widget icon" image and I will post it later..
Thanks a bunch bro!

Posted: :D
viewtopic.php?f=11&t=4745

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