摘要:本文主要向大家介绍了photoshop教程:设置前景色和背景色,通过具体的内容向大家展现,希望对大家学习photoshop教程有所帮助。
本文主要向大家介绍了photoshop教程:设置前景色和背景色,通过具体的内容向大家展现,希望对大家学习photoshop教程有所帮助。
本节将演示如何使用脚本,设置Photoshop的前景色和背景色。首先创建一个空白的脚本文档,并保存在硬盘上某个位置。
并输入脚本代码:
var answer = confirm("您需要随机设置前景色和背景色吗?");
[confirm]命令会弹出一个包含[是/否]的确认框,由用户决定是否执行某一个操作。
选择的结果[是/否]将保存在[answer]变量里。
if(answer)
{
app.foregroundColor.rgb.red = Math.random() * 255;
app.foregroundColor.rgb.green = Math.random() * 255;
app.foregroundColor.rgb.blue = Math.random() * 255;
app.backgroundColor.rgb.red = Math.random() * 255;
app.backgroundColor.rgb.green = Math.random() * 255;
app.backgroundColor.rgb.blue = Math.random() * 255;
}
判断用户的选择,如果用户选择[是],则执行接下来的动作。
然后就可以设置Photoshop前景色和背景色了。
[Math.random]命令会生成一个0至1之间的随机值,随机值乘以255则生成0-255之间的随机值。
完整的脚本文件:
var answer = confirm("您需要随机设置前景色和背景色吗?");
if(answer)
{
app.foregroundColor.rgb.red = Math.random() * 255;
app.foregroundColor.rgb.green = Math.random() * 255;
app.foregroundColor.rgb.blue = Math.random() * 255;
app.backgroundColor.rgb.red = Math.random() * 255;
app.backgroundColor.rgb.green = Math.random() * 255;
app.backgroundColor.rgb.blue = Math.random() * 255;
}
我们的脚本已经编写完成,现在把它保存下来。
然后切换到Photoshop,然后依次点击[文件] > [脚本] > [浏览],打开刚刚保存的脚本文件。Photoshop将直接调用并执行该脚本。
在弹出的[脚本警告]弹出框窗口,点击[是]按钮,开始设置前景色和背景色,请留意工具条下方前景色和背景色的变化。
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注常用软件Photoshop频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号