1

Here is my fiddle : http://jsfiddle.net/ZYJsK/302/

I want to animate texts like this site : http://vegas.jaysalvat.com/

This section ====> enter image description here

My Js :

var app = angular.module("app", []);

app.controller('mainCtrl', function ($scope,$element) {
    var texts = ["example1", "example2", "example3"];
    var textToAdd = angular.element("#sizin");
    var count = 0;
    function changeText (){
      textToAdd.text(texts[count]);
        count < 3 ? count++ : count = 0;
    }

    setInterval(changeText,500);
});

Any Advice Would be great ? Thanks a million

3
  • 2
    So, what is the problem? Commented Oct 24, 2015 at 20:52
  • i want to animate it like the website i mentioned i don't know how to Commented Oct 24, 2015 at 20:57
  • codepen.io/GreenSock/pen/gFHza check this please , GSAP can do the tricks , have you worked with GSAP ? Commented Oct 24, 2015 at 20:59

1 Answer 1

2

You should bind to scope variable and change it by timer and call $apply.

Something like this.

$scope.initComVal = '.com';
$scope.comval = '';
function changeText (){
    if($scope.comval.length === $scope.initComVal.length)
        $scope.comval = '';
    else
    {
        $scope.comval = $scope.initComVal.substring(0, $scope.comval.length+1);
        $scope.$apply();
    }
}

JSFiddle

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer , how about multi word ? .com and available ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.