public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Main thread only:
            Callback.MainThread(delegate(){
                // Get the <particles> element:
                HtmlParticlesElement tag = style.Element as HtmlParticlesElement;

                if (tag == null)
                {
                    // Ok!
                    return;
                }

                Quaternion rotation;

                if (value == null)
                {
                    rotation = Quaternion.identity;
                }
                else
                {
                    rotation = value.GetQuaternion(style.RenderData, this);
                }

                // Update rotation:
                tag.Rotation = rotation;

                // Repos:
                tag.Relocate();
            });

            // Ok!
            return(ApplyState.Ok);
        }
Exemple #2
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Main thread only:
            Callback.MainThread(delegate(){
                // Get the <particles> element:
                HtmlParticlesElement tag = style.Element as HtmlParticlesElement;

                if (tag == null)
                {
                    // Ok!
                    return;
                }

                Vector3 scale;

                if (value == null)
                {
                    scale = Vector3.one;
                }
                else
                {
                    float x = 1f;
                    float y = 1f;
                    float z = 1f;

                    if (value[0] != null)
                    {
                        x = value[0].GetDecimal(style.RenderData, this);
                    }

                    if (value[1] != null)
                    {
                        y = value[1].GetDecimal(style.RenderData, this);
                    }

                    if (value[2] != null)
                    {
                        z = value[2].GetDecimal(style.RenderData, this);
                    }

                    scale = new Vector3(x, y, z);
                }

                // Update scale:
                tag.Scale = scale;

                // Repos:
                tag.Relocate();
            });

            // Ok!
            return(ApplyState.Ok);
        }