示例#1
0
        /// <summary>
        /// Play the specified clip.
        /// </summary>
        /// <param name="clip">Clip.</param>
        /// <param name="startDelay">Optional delay before the playing starts.</param>
        /// <param name="loop">If set to <c>true</c> loop indefinitely.</param>
        public void Play(AnimatedClip clip, float startDelay = 0, bool loop = true)
        {
            if (clip == null || clip.Frames.Length == 0 || clip.IsDisposed())
            {
                Debug.LogError("Attempted to play an empty or disposed clip.");
                return;
            }

            Stop();
            Resize(clip);
            isPaused = false;

            playCoroutine = CRPlay(clip, startDelay, loop);
            StartCoroutine(playCoroutine);
        }
示例#2
0
文件: Gif.cs 项目: akil03/bx
        /// <summary>
        /// Exports a GIF image from the provided clip.
        /// Allows setting looping mode of the output image.
        /// </summary>
        /// <param name="clip">The clip to export to GIF format.</param>
        /// <param name="filename">Filename to save the output GIF.</param>
        /// <param name="loop">-1 to disable, 0 to loop indefinitely, >0 to loop a set number of times.</param>
        /// <param name="quality">Quality setting for the exported image. Inputs will be clamped between 1 and 100. Bigger values mean better quality but slightly longer processing time. 80 is generally a good value in terms of time-quality balance.</param>
        /// <param name="threadPriority">Priority of the GIF encoding thread.</param>
        /// <param name="exportProgressCallback">Export progress callback: 1st parameter is the provided clip, 2nd parameter is the export progress from 0 to 1.</param>
        /// <param name="exportCompletedCallback">Export completed callback: 1st parameter is the provided clip, 2nd parameter is the filepath of the exported GIF.</param>
        public static void ExportGif(AnimatedClip clip, string filename, int loop, int quality, System.Threading.ThreadPriority threadPriority, Action <AnimatedClip, float> exportProgressCallback, Action <AnimatedClip, string> exportCompletedCallback)
        {
            if (clip == null || clip.Frames.Length == 0 || clip.IsDisposed())
            {
                Debug.LogError("Attempted to export GIF from an empty or disposed clip.");
                return;
            }

            if (String.IsNullOrEmpty(filename))
            {
                Debug.LogError("Exporting GIF failed: filename is null or empty.");
                return;
            }

            // Start the actual export process
            Instance.StartCoroutine(CRExportGif(clip, filename, loop, quality, threadPriority, exportProgressCallback, exportCompletedCallback));
        }