-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prior to this commit spinners would use the default speed of 250 milliseconds set in the managers constructor method. This commit introduces a new concept of animation properties that allow each spinner to have it's own default speed. The speeds used come from https://wiki.tcl-lang.org/page/Text+Spinner. It is still possible to globally override the speed via the managers WithFrameDuration option.
- Loading branch information
Showing
6 changed files
with
109 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/chelnak/ysmrr" | ||
"github.com/chelnak/ysmrr/pkg/animations" | ||
) | ||
|
||
func main() { | ||
availableAnimations := animations.GetAnimations() | ||
|
||
for _, animation := range availableAnimations { | ||
manager := ysmrr.NewSpinnerManager( | ||
ysmrr.WithAnimation(animation), | ||
) | ||
|
||
_ = manager.AddSpinner(fmt.Sprintf("This is spinner %d...", animation)) | ||
manager.Start() | ||
time.Sleep(2 * time.Second) | ||
manager.Stop() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters