It is currently March 28th, 2024, 11:51 pm

Circular Line with Gradient

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Circular Line with Gradient

Post by jsmorley »

:-)

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
R=0
U=[!UpdateMeasure MeasureRotate][!UpdateMeter MeterShape][!Redraw]

[MeterShape]
Meter=Shape
X=40
Y=40
Shape=Rectangle 0,0,100,30 | StrokeWidth 0 | Fill LinearGradient1 myGradient | Rotate #R#
myGradient=-#R# | 255,0,0,255 ; 0.0 | 0,255,0,255 ; 0.5 | 0,0,255,255 ; 1.0
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureRotate "Execute 1"]

[MeasureRotate]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Rotate, 1, 180
Rotate=[!SetVariable R "(#R#+2 %360)]#U#
DynamicVariables=1
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Circular Line with Gradient

Post by balala »

jsmorley wrote::-)

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
R=0
U=[!UpdateMeasure MeasureRotate][!UpdateMeter MeterShape][!Redraw]

[MeterShape]
Meter=Shape
X=40
Y=40
Shape=Rectangle 0,0,100,30 | StrokeWidth 0 | Fill LinearGradient1 myGradient | Rotate #R#
myGradient=-#R# | 255,0,0,255 ; 0.0 | 0,255,0,255 ; 0.5 | 0,0,255,255 ; 1.0
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureRotate "Execute 1"]

[MeasureRotate]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Rotate, 1, 180
Rotate=[!SetVariable R "(#R#+2 %360)]#U#
DynamicVariables=1
Probably using the Rotation parameter on the Shape meters is a much simpler solution than any other, but what if the shape has more Shape options, as it had on ChicknwithNoName's initial code? For me it's not clear yet, how it can be used in such cases and I couldn't get it yet to work.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Circular Line with Gradient

Post by jsmorley »

balala wrote:Probably using the Rotation parameter on the Shape meters is a much simpler solution than any other, but what if the shape has more Shape options, as it had on ChicknwithNoName's initial code? For me it's not clear yet, how it can be used in such cases and I couldn't get it yet to work.
TransformationMatrix might be a better answer on a Shape meter that has multiple ShapeN options, As I expect it would be complicated to get the right Rotate on each of the shapes in such a way that they rotated together in a visibly logical way.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Circular Line with Gradient

Post by balala »

jsmorley wrote:TransformationMatrix might be a better answer on a Shape meter that has multiple ShapeN options, As I expect it would be complicated to get the right Rotate on each of the shapes in such a way that they rotated together in a visibly logical way.
Right. As I said, I couldn't figure out a way to achieve a proper rotation in a such case, using the Rotation. Eg, adding a Rotate 45 parameter to each ShapeN option of ChicknwithNoName's initial code, this is what I got (also added a SolidColor option):
Image
Same shape(s), this time not rotated:
Image
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Circular Line with Gradient

Post by fonpaolo »

jsmorley wrote:TransformationMatrix might be a better answer on a Shape meter that has multiple ShapeN options, As I expect it would be complicated to get the right Rotate on each of the shapes in such a way that they rotated together in a visibly logical way.
So, the form produced isn't a single image, but a layered set of single images, more or less like what is produced by a skin.
As I said before, I'm not an expert with Shape meter, I'm right at the beginning...
But this is already starting to get me in trouble on how, or if, I can replace images with the new Shape meter.
I hope balala can forgive me if I don't want to use TrasformationMatrix on every single image contained in every skin of my suite, I already know what a nightmare can be to resize a single shape, now also the rotation... my images aren't really very simple and they're many.
At least, I was hoping it would be a little easier... :17what
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Circular Line with Gradient

Post by balala »

fonpaolo wrote:I hope balala can forgive me if I don't want to use TrasformationMatrix on every single image contained in every skin of my suite,
I think I don't have to forgive you, everyone uses what he wants. I admit TransformationMatrix isn't a simple option, it has a more or less complicated math involved. You have to use it for a shorter or longer period to get used to it. But once you did, it become much easier to use. I find this option useful, many times.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Circular Line with Gradient

Post by fonpaolo »

I tried and I was able to use it from the beginning, only a "minor mistake" in applying the "move" part...
However, I'm still verifying if it's causing additional CPU usage, or, adding TransformationMatrix highlighted other problems, because if I load that skin, CPU usage passes from 0-1% to 2-4% and this really scares me.
But I prefer to use less complicated ways to obtain what I want.
I admit, I used some complex formulas here and there, but better than using simpler calculations and many more measures.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Circular Line with Gradient

Post by balala »

fonpaolo wrote:I tried and I was able to use it from the beginning, only a "minor mistake" in applying the "move" part...
However, I'm still verifying if it's causing additional CPU usage, or, adding TransformationMatrix highlighted other problems, because if I load that skin, CPU usage passes from 0-1% to 2-4% and this really scares me.
But I prefer to use less complicated ways to obtain what I want.
I admit, I used some complex formulas here and there, but better than using simpler calculations and many more measures.
If you're talking about the TransformationMatrix, there are situations when this is the simplest way to achieve something, but in other circumstances... Well, as I said, the involved math can become complicated.
However, I'm not sure (but definitely I'm lazy to search), but I think once you've wrote you have many (I think there you said 15-20) skins loaded all the time. If I'm right, the 0-1% CPU usage is very good.
Forgive me if I'm wrong and this was said by someone else...
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Circular Line with Gradient

Post by fonpaolo »

No, you're almost right. ;-)
I'm using more than 30 skins and some of them are two or three combined into one, using multiple .inc files.
I prefer to not post my desktop, simply because some of them are limited only to Europe and can't be used anywhere else in the world.

At the moment I solved some performance problems, or at least I hope so...
I don't know why, adding more and more things, measures and/or meters, ends up using more and more CPU! :sly:
I was and still am convinced that using Shape meter could help solve a lot of problems and CPU usage, but it's already becoming complicated to try to duplicate "simple" images with a Shape meter.
I hope further development can add more features and I hope the ones I need.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Circular Line with Gradient

Post by balala »

fonpaolo wrote:I don't know why, adding more and more things, measures and/or meters, ends up using more and more CPU! :sly:
Why are you surprised? Isn't this normal? I'd say it is...