It is currently November 26th, 2022, 8:24 pm

Preserveaspectratio and scalemargins get the sliding effect

Skins that control functions in Windows or Rainmeter
Unight
Posts: 19
Joined: November 20th, 2012, 5:12 am

Preserveaspectratio and scalemargins get the sliding effect

Post by Unight »

a small demo.

Code: Select all

[Rainmeter]
 Update=40
 MiddleMouseUpAction=!Refresh #CURRENTCONFIG#
 DynamicWindowSize=1

[Metadata]
 Author=Unight
 Name=Preserveaspectratio and scalemargins get the sliding effect
 Version=1.0
 Information=small and interesting demo
 License=Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
 
[Variables]
step=6
maxsize=191

[calc]
Measure=Calc
Formula=[calc]+#step#
DynamicVariables=1
IfAboveAction=[!SetOption "calc" "UpdateDivider" "-1" ][!SetOption "calc" "Formula" "#maxsize#"]
IfAboveValue=(#maxsize#-#step#)

[calcsin]
Measure=Calc
Formula=abs(sin(90/#maxsize#*[calc]*pi/180))*#maxsize#
DynamicVariables=1

[slideshow]
meter=image 
imagename=demo.png
Preserveaspectratio=0
w=([calcsin])
h=377
x=1200
DynamicVariables=1
Scalemargins=0,0,[calcsin],0

User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Preserveaspectratio and scalemargins get the sliding eff

Post by Kaelri »

Well done. :) The sine curve is a nice touch.

If you're planning to continue along these lines, here's something that might help you. It's a formula I worked out for transitioning any linear number value (X, Y, W, H, alpha, etc.) such that it accelerates at the beginning and decelerates at the end:

Code: Select all

Xi + ((Xf - Xi) / 2) + ((Xf - Xi) / 2) * sin(pi * (t - 1/2))
(Xi is the initial position constant, Xf is the final position constant, and t is the current point in the progression, between 0 and 1. By increasing or decreasing t at a constant rate, the formula evaluates the actual position over time.)