Show / Hide Table of Contents

Interface ITweenPlugin

Base interface for Animate plugins.

Namespace: Sttz.Tweener.Core
Assembly: cs.temp.dll.dll
Syntax
public interface ITweenPlugin
Remarks

The entry point for a plugin is its PluginLoader method. The loader gets called with a tween and should then check if the plugin applies to the given tween. If everything is fine, it should call Sttz.Tweener.Tween.LoadPlugin(Sttz.Tweener.Core.ITweenPlugin,System.Boolean,System.Object) to actually register itself with the tween.

In addition to the loader, the plugin should also provide and extension method for Tween<TTarget, TValue>, that calls the loader for the current tween and requires the plugin.

All built-in plugins follow these conventions:

  • The plugin container is a static class that contains the loader method, the tween extension method and private plugin implementation classes.
  • If the plugin has options the user can set, it should optionally provide a property inline-syntax via PropertyOptions, a CustomLoader method that returns a loader with the given options applied (.e.g. see CustomLoader(TweenMaterial.PropertyType)) and an extension method on Tween. The extension method can use concrete types to provide type-checking (e.g. extend Tween<Transform, TValue> if the plugin only works on transforms).
  • The plugin can contain multiple private implementations that are chosen by the loader method.
  • The error returned by the loader is handled depending on wether the plugin is required. If it's required, the error is fatal and logged as error. If it's not required, the error is silent only only logged as debug message. If the plugin wants additional logging, it can call Log(TweenLogLevel, String) on the tween.

Methods

Initialize(Tween, TweenPluginType, ref Object)

Initialize the plugin.

Declaration
string Initialize(Tween tween, TweenPluginType initForType, ref object userData)
Parameters
Type Name Description
Tween tween

Tween the plugin is loaded for

TweenPluginType initForType

The types the plugin is actually used for

System.Object userData

User data set by the loader

Returns
Type Description
System.String

null on success or an error on failure

Remarks

In contrast to the loader, this method is not called for every tween and only if the plugin is actually used. Heavy initialization should be deferred to this method.

Back to top © 2018 Adrian Stutz