attract icon indicating copy to clipboard operation
attract copied to clipboard

Missing Hyperspin animations in hyperspin.nut

Open sergiohf opened this issue 4 years ago • 0 comments

I was changing the hyperspin.nut to use in my pi (i am not a coder) and i noticed that the hyperspin.nut lacks several animations. So to "solve" (its not a solution, more a workaround) the problem i have "merged" similar animations, so the Hyperspin Themes dont become static when unlisted animations are called. In my opinion with this simple change the HS Themes became much better. Since i have no idea if what i did is correct, if anyone has better ideas or how to sugest such change, i will post here for anyone interested:

change from line 651 of the original hyperspin.nut:


			switch ( type )
			{
			case "pixelate":
			case "stripes":
			case "flag":
			case "strobe":
			case "stripes 2":
			case "fade":
				if ( tint > 0 )
				{
					local cfg = {
						when = ttype,
						property="alpha",
						start=0,
						end =255,
						time = tint,
						delay = dint
					};
					hs_animation.add( PropertyAnimation( obj, cfg ) );
					if ( obj2 )
						hs_animation.add( PropertyAnimation( obj2, cfg ) );
					call_into_transition=true;
				}
				break;
				
	
				case "pixelate zoom out":
				if ( tint > 0 )
				{
					local cfg = {
						when = ttype,
						property="alpha",
						start=0,
						end =255,
						time = tint,
						delay = dint
					};
				
				{
						local cfg2 = {
						when = ttype,
						property = "scale",
						start = 2.0,
						end = 1.0,
						time = tint,
						delay = dint,
						tween = Tween.Quad
				};
	
					hs_animation.add( PropertyAnimation( obj, cfg ) );
					hs_animation.add( PropertyAnimation( obj, cfg2 ) );

				}	
				if ( obj2 )
					hs_animation.add( PropertyAnimation( obj2, cfg ) );
					call_into_transition=true;
				}
				break;			
					
				case "arc shrink":
				case "zoom out":
				if ( tint > 0 )
				{
					local cfg = {
						when = ttype,
						property="scale",
						start= 2.0,
						end = 1.0,
						time = tint,
						delay = dint,
						tween = Tween.Quad
					};

					hs_animation.add( PropertyAnimation( obj, cfg ) );
					if ( obj2 )
						hs_animation.add( PropertyAnimation( obj2, cfg ) );
					call_into_transition=true;
				}
				break;			
			
			case "pendulum":
			case "chase":
			case "ease":
			case "flip":
			case "rainfloat":
			case "scroll":
			case "sweep left":
			case "sweep right":
			case "bounce around 3d":
			case "bounce random":
			case "elastic":
			case "elastic bounce":
				if ( tint > 0 )
				{
					local vert = ((start=="top") || (start=="bottom"));
					local flip = ((start=="bottom") || (start=="right"));

					local tw = "linear";
					if ( type == "elastic bounce" )
						tw = "bounce";
					else if ( type == "elastic" )
						tw = "elastic";

					local cfg = {
						when = ttype,
						property= vert ? "y" : "x",
						start = flip ?
							( vert ? fe.layout.height : fe.layout.width )
							: ( vert ? -h : -w ),
						end = vert ? y - h/2 : x - w/2,
						time = tint,
						delay = dint,
						tween = tw,
						easing = Easing.In
					};

					hs_animation.add( PropertyAnimation( obj, cfg ) );
					if ( obj2 )
					{
						local cfg2 = clone cfg;
						cfg2["end"] = vert ? y - obj2.height/2 : x - obj2.width/2;
						hs_animation.add( PropertyAnimation( obj2, cfg2 ) );
					}
					call_into_transition=true;
				}
				break;

			case "grow x":
			case "arc grow":
			case "grow blur":
			case "grow bounce":
			case "grow center shrink":
			case "grow":
			case "grow bounce":
				if ( tint > 0 )
				{
					local cfg = {
						when = ttype,
						property= "width",
						start=0,
						end = w,
						tween = ( type == "grow bounce" ) ? "bounce" : "linear",
						time = tint,
						delay = dint
					};

					hs_animation.add( PropertyAnimation( obj, cfg ) );

					if ( obj2 )
					{
						local cfg2 = clone cfg;
						cfg2["end"] = obj2.width;
						hs_animation.add( PropertyAnimation( obj2, cfg2 ) );
					}

					if ( type != "grow x" )
					{
						local cfg2 = {
							when = ttype,
							property= "x",
							start=x-w/2,
							end = x-w/2,
							time = tint,
							delay = dint
						};

						hs_animation.add( PropertyAnimation( obj, cfg2 ) );
						if ( obj2 )
						{
							local cfg3 = clone cfg2;
							cfg3["start"] = x - obj2.width/2;
							cfg3["end"] = x - obj2.width/2;
							hs_animation.add( PropertyAnimation( obj2, cfg3 ) );
						}
					}
					call_into_transition=true;
				}
				break;

			case "grow y":
				if ( tint > 0 )
				{
					local cfg = {
						when = ttype,
						property= "height",
						start=0,
						end = h,
						time = tint,
						delay = dint
					};

					hs_animation.add( PropertyAnimation( obj, cfg ) );
					if ( obj2 )
					{
						local cfg2 = clone cfg;
						cfg2["end"] = x - obj2.height;
						hs_animation.add( PropertyAnimation( obj2, cfg2 ) );
					}
					call_into_transition=true;
				}
				break;
				
			}
		}
	}

	foreach ( k,v in found_tags )
	{
		if ( !v )
			::hs_ent[k].obj.file_name = "";
	}

sergiohf avatar Nov 17 '20 02:11 sergiohf